package com.ychs.lawyerback01.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
import java.util.List;

@Data
public class UserOptDTO {
    private Long id;

    @NotBlank(message = "用户名不能为空")
    @Size(min = 5, max = 10, message = "用户名的长度是5-10位")
    private String username;

    @NotBlank(message = "真实姓名不能为空")
    @Size(min = 2, max = 20, message = "真实姓名的长度是2-20位")
    private String realName;

    @NotBlank(message = "电话不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "电话不合法")
    private String phone;

    private String sex;
    private String flag; // 是否在职(0:正常在职,1:已离职)
    private String remark;
    private Long roleId;
    private String password;
    private String nation;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthDate;

    @NotBlank(message = "身份证号不能为空")
    @Pattern(regexp = "^\\d{17}([0-9]|X|x)$", message = "身份证号格式不正确")
    private String idCard;

    private String politicalStatus;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date partyDate;

    @Pattern(regexp = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", message = "邮箱格式不正确")
    private String email;

    private String address; // 现居住地-可选
    private String education;

    // 照片和简历上传
    private String photoPath;
    private MultipartFile photoFile; // 一寸照片上传-蓝底
    private String resumePath;
    private MultipartFile resumeFile; // 个人简历上传-从大学开始

    // 职业信息
    private String graduateSchool; // 毕业院校
    private String major; // 专业
    private String practiceCertNo; // 执业证号
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @NotNull(message = "取得职业资格日期不能为空")
    private Date qualificationDate; // 取得职业资格日期

    private String specialty; // 业务特长

    private String isPartner; // 是否合伙人(0:否,1:是)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date hireDate; // 聘用日期
    private String lawyerType; // 律师类型(律师和兼职律师)
    private String partTimeWorkUnit; // 兼职律师工作单位
    private String isDeputy; // 是否担任人大代表或政协委员(0:否,1:是)
    private String rewards; // 受过的奖励
    private String punishments; // 受过的处分

    // 社保信息
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date socialSecurityDate; // 首次社保缴费日期
    private String socialSecurityNo; // 社保编号-可选

    private String socialPosition; // 社会职务

    // 关联信息
    private List<CertificateDTO> certificates; // 证书列表
    private List<AcademicDTO> academics; // 学术成果
    private List<LegalAdvisorDTO> legalAdvisors; // 担任法律顾问的单位
    private List<WorkChangeDTO> workChanges; // 工作变动记录
}
